﻿
using System ;
using System.IO ;
using System.Windows.Forms ;

using MskEdit.Dxf.Model ;
using MskEdit.Dxf.Backend ;


namespace MskEdit.Dxf.Frontend
{ 
    public class DxfDocumentTreeNode : TreeNode 
    {
        DxfDocument dxfDocument_ ;


        public DxfDocumentTreeNode( DxfDocument dxfDocument ) {
        
            dxfDocument_    = dxfDocument ;
            this.Tag        = dxfDocument ;
            this.Text       = dxfDocument.Name ;
            
            DxfHeaderTreeNode dxfHeaderTreeNode = DxfHeaderTreeNode.TryFrom( dxfDocument_.Header, null ) ;
            if ( dxfHeaderTreeNode != null )
                Nodes.Add( dxfHeaderTreeNode ) ;
            
            DxfClassesTreeNode dxfClassesTreeNode = DxfClassesTreeNode.TryFrom( dxfDocument_.Classes, null ) ;
            if ( dxfClassesTreeNode != null )
                Nodes.Add( dxfClassesTreeNode ) ;
            
            DxfTablesTreeNode dxfTablesTreeNode = DxfTablesTreeNode.TryFrom( dxfDocument_.Tables, null ) ;
            if ( dxfTablesTreeNode != null )
                Nodes.Add( dxfTablesTreeNode ) ;
            
            DxfBlocksTreeNode dxfBlocksTreeNode = DxfBlocksTreeNode.TryFrom( dxfDocument_.Blocks, null ) ;
            if ( dxfBlocksTreeNode != null )
                Nodes.Add( dxfBlocksTreeNode ) ;
            
            DxfEntitiesTreeNode dxfEntitiesTreeNode = DxfEntitiesTreeNode.TryFrom( dxfDocument_.Entities, null ) ;
            if ( dxfEntitiesTreeNode != null )
                Nodes.Add( dxfEntitiesTreeNode ) ;
            
            DxfObjectsTreeNode dxfObjectsTreeNode = DxfObjectsTreeNode.TryFrom( dxfDocument_.Objects, null ) ;
            if ( dxfObjectsTreeNode != null )
                Nodes.Add( dxfObjectsTreeNode ) ;
        }
    }
}
